package com.bringway.p2p.controller;

import org.apache.log4j.Logger;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.bringway.framework.controller.JsonController;
import com.bringway.framework.util.RequestUtils;
import com.bringway.global.domain.SysUserDetails;
import com.bringway.p2p.service.QxtzjlService;
import com.bringway.p2p.service.ZqzrService;

import net.sf.json.JSONObject;
/**  
 * @类名 QxtzjlController  
 * @功能 TODO  新债权转让后台界面
 * @作者 js 
 * @日期 2016年7月11日 上午11:24:21  
 *    
 */
@Controller
@RequestMapping("/qxtzjl")
public class QxtzjlController extends JsonController {
	
	Logger logger=Logger.getLogger(QxtzjlController.class);
	
	@Autowired
	private QxtzjlService qxtzjlService;
	
	/**
	 * @作者 qjy
	 * @方法名 queryQxtzjl 
	 * @功能 TODO 查询债权转让申请列表
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/queryQxtzjl")
	public ModelAndView queryQxtzjl(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		
		Integer start = RequestUtils.getIntParameter(request, "start");
		Integer limit = RequestUtils.getIntParameter(request, "limit");
		String startDate = RequestUtils.getStringParameter(request, "startDate");
		String endDate = RequestUtils.getStringParameter(request, "endDate");
		String username=RequestUtils.getStringParameter(request, "username");
		String htbh=RequestUtils.getStringParameter(request, "htbh");
		String tzxm=RequestUtils.getStringParameter(request, "tzxm");
		params.put("start", start);
		params.put("limit", limit);
		params.put("startDate", startDate);
		params.put("endDate", endDate);
		params.put("username", username);
		params.put("htbh", htbh);
		params.put("tzxm", tzxm);
		List<Map<String, Object>> list=qxtzjlService.queryQxtzjl(params);
		int count=qxtzjlService.getQxtzjlCount(params);
		String Sum = qxtzjlService.gettzjeSum(params);
		result.put("Sum", Sum);
		result.put("data", list);
		result.put("total", count);
		
		serialize(request, response, result);
		return null;
	}
	
	
	
}
